package github.leavesczy.reactivehttpsamples.ui.addbridge

import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.blankj.utilcode.util.CollectionUtils
import com.blankj.utilcode.util.StringUtils
import github.leavesczy.reactivehttpsamples.base.BaseFragment
import github.leavesczy.reactivehttpsamples.core.mode.BridgeRecordItem
import github.leavesczy.reactivehttpsamples.core.mode.IdentifyCaeData
import github.leavesczy.reactivehttpsamples.databinding.FragmentCaeModelBinding
import github.leavesczy.reactivehttpsamples.ui.addbridge.func.BridgeFunction
import github.leavesczy.reactivehttpsamples.util.BridgeDataHelper
import github.leavesczy.reactivehttpsamples.util.Logger
import github.leavesczy.reactivehttpsamples.util.exception.BusException
import github.leavesczy.reactivehttpsamples.widget.dialog.BridgeWidthCalculateDialog
import java.util.Objects


class CaeModelBridge : BaseFragment(), BridgeFunction {
    companion object {
        fun newInstance(item: BridgeRecordItem?): Fragment {
            val fragment = CaeModelBridge()
            val bundle = Bundle()
            item?.let {
                bundle.putSerializable("item", it)
            }
            fragment.arguments = bundle
            return fragment
        }
    }

    private var bind: FragmentCaeModelBinding? = null

    private val mBind: FragmentCaeModelBinding get() = bind!!

    private var bridgeType: String? = null

    private var itemData: BridgeRecordItem? = null

    private var paramNew: BridgeWidthCalculateDialog.Param? = null

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        bind = FragmentCaeModelBinding.inflate(inflater, container, false)
        return mBind.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        initListener()
        initRefresh()
        initData()
        initView()
    }


    private fun initView() {
        itemData?.let {
            val editable = it.isCanAnalysis() && !getForbiddenEdit(activity)
            val data = it.identifyCae
            dealData(data, editable)

        }
    }

    private fun initData() {
        itemData = arguments?.getSerializable("item") as? BridgeRecordItem

        mBind.icCbBridgeSpanNumber.setItems(BridgeDataHelper.getMainSpanNumberType1List())
        mBind.icCbMainMaterialType.setItems(BridgeDataHelper.getMainMaterialTypeList())
        mBind.icCbSingleBeamInterfaceType.setItems(BridgeDataHelper.getSingleBeamInterfaceTypeList())
        mBind.icCbArchBridgeType.setItems(BridgeDataHelper.getArchBridgeTypeList())
        mBind.icCbArchSectionType.setItems(BridgeDataHelper.getArchSectionTypeList())

        mBind.icTfStiffeningGirderMaterialType.setItems(BridgeDataHelper.getStiffeningGirderMaterialTypeList())
//        mBind.icTfStiffeningGirderSectionType.setItems(BridgeDataHelper.getStiffeningGirderSectionTypeListByMaterialType(mBind.icTfStiffeningGirderMaterialType.select.value))

        mBind.icCbMainTowerVerticalShape.setItems(BridgeDataHelper.getMainTowerVerticalShapeList())
        mBind.icCbMainTowerHorizontalShape.setItems(BridgeDataHelper.getMainTowerHorizontalShapeList())

        mBind.icCbAuxiliaryPierNumber.setItems(BridgeDataHelper.getAuxiliaryPierNumberList())

    }


    fun initListener() {
        mBind.icCbBridgeSpanNumber.setSelectCallback {
            //选择了几个跨境
            //初始化跨径
            if (it.value.toInt() != mBind.icBoxSpanArrangementContain.childSize()) {
                Logger.i("跨径数量变动，初始化跨径布置，needsize:${it.value},currentsize:${mBind.icBoxSpanArrangementContain.childSize()}")
                mBind.icBoxSpanArrangementContain.initViewSize(it.name.toInt())
            }
            //初始化 立柱数量
            if ((it.value.toInt() + 1) != mBind.icBoxColumnNumberContain.childSize()) {
                mBind.icBoxColumnNumberContain.initViewSize(it.name.toInt() + 1, "1")
            }
        }

        mBind.icCbArchBridgeType.setSelectCallback {
            val listStr = when (it.value) {
                "上承式", "下承式" -> {
                    "[100]"
                }

                "中承式" -> {
                    "[100,100,100]"
                }

                "飞燕式" -> {
                    "[100,100,100,100,100]"
                }

                else -> {
                    "[100]"
                }
            }

        }

        mBind.icTfStiffeningGirderMaterialType.setSelectCallback {
            Logger.i("联动，选择后，初始化截面类型-->setSelectCallback:${it.name}")
            mBind.icTfStiffeningGirderSectionType.setItems(
                BridgeDataHelper.getStiffeningGirderSectionTypeListByMaterialType(
                    it.value
                )
            )
            if (StringUtils.equals(it.value, itemData?.identifyCae?.stiffeningGirderMaterialType)) {
                Logger.i("联动，初始化截面类型---赋值")
                dealSpinner(
                    mBind.icTfStiffeningGirderSectionType,
                    itemData?.identifyCae?.stiffeningGirderSectionType,
                    mBind.icTfStiffeningGirderSectionType.spinnerEnable
                )
            } else if (Objects.nonNull(defaultData) && StringUtils.equals(
                    it.value,
                    defaultData?.stiffeningGirderMaterialType
                )
            ) {
                Logger.i("联动，初始化截面类型---默认值")
                dealSpinner(
                    mBind.icTfStiffeningGirderSectionType,
                    defaultData?.stiffeningGirderSectionType,
                    mBind.icTfStiffeningGirderSectionType.spinnerEnable
                )
            }
        }

        mBind.icTfBridgeWidth.initButtonTextListener {
            //桥梁宽度 宽度估计按钮
            BridgeWidthCalculateDialog()
                .init(
                    requireContext(),
                    this@CaeModelBridge.paramNew,
                    object : BridgeWidthCalculateDialog.Callback {
                        override fun ok(
                            result: String?,
                            paramNew: BridgeWidthCalculateDialog.Param?
                        ) {
                            mBind.icTfBridgeWidth.editTextStr = result
                            this@CaeModelBridge.paramNew = paramNew
                        }

                        override fun cancel() {

                        }

                    })
                .show("BridgeWidthCalculateDialog")
        }
        //跨径布置 估计按钮
        mBind.icBoxSpanArrangementContain.initButtonTextListener {
            val bridgeLengthStr = mBind.icTfBridgeLength.editTextStr
            if (StringUtils.isEmpty(bridgeLengthStr)) {
                showToast("请先输入桥梁总长度")
                return@initButtonTextListener
            }
            //计算拿到最新的的数据，按钮赋值
            mBind.icBoxSpanArrangementContain.resetValue(
                getSpanValuesByBridgeLength(
                    bridgeLengthStr,
                    mBind.icBoxSpanArrangementContain.childSize()
                )
            )

            showToast("处理完成")
        }
        //桥塔高度 估计按钮
        mBind.icTfMainTowerFloorUpperHeight.initButtonTextListener {
            val value = mBind.icBoxSpanArrangementContain.spanData
            if (CollectionUtils.isEmpty(value)) {
                showToast("未设置跨径布置")
                return@initButtonTextListener
            }
            if (value.size != mBind.icBoxSpanArrangementContain.childSize()) {
                showToast("跨径布置数据不全，请先补全数据")
                return@initButtonTextListener
            }
            mBind.icTfMainTowerFloorUpperHeight.editTextStr = getTowerFloorUpperHeight(value)

            showToast("处理完成")

        }
    }

    private fun getTowerFloorUpperHeight(values: MutableList<String>): String {
        var maxDouble: Double = 0.0
        values.forEach {
            if (it.toDouble() > maxDouble) {
                maxDouble = it.toDouble()
            }
        }
        return String.format("%.2f", maxDouble / 3.6)
    }

    fun getSpanMax(): String {
        val values = mBind.icBoxSpanArrangementContain.spanData
        if (CollectionUtils.isEmpty(values)) {
            throw BusException("未设置跨径布置")
        }
        if (values.size != mBind.icBoxSpanArrangementContain.childSize()) {
            throw BusException("跨径布置数据不全，请先补全数据")
        }
        var maxDouble: Double = 0.0
        values.forEach {
            if (it.toDouble() > maxDouble) {
                maxDouble = it.toDouble()
            }
        }
        return maxDouble.toString()
    }
    fun getTowerNumber():String{
        return (mBind.icCbBridgeSpanNumber.select.value.toInt()-1).toString()
    }

    fun getTowerHeightTotal():String{
        val heightRatio = mBind.icTfMainTowerFloorUpperLowerHeightRatio.editTextStr
        if (StringUtils.isEmpty(heightRatio)) {
            throw BusException("高度比未设置")
        }
        val height = mBind.icTfMainTowerFloorUpperHeight.editTextStr
        if (StringUtils.isEmpty(height)) {
            throw BusException("高度未设置")
        }
        val heightRatioDou= heightRatio.toDouble()
        val heightDou= height.toDouble()
        return String.format ("%.2f",(heightDou/heightRatioDou)*(heightRatioDou+1))
    }

    fun getMainBeamType():String{
       val materialType=mBind.icTfStiffeningGirderMaterialType.select.value
        when(materialType){
            "3"->{
                return "钢混组合梁"
            }
            "1"->{
                return "混凝土梁"
            }
            "2"->{
                val sectionType=mBind.icTfStiffeningGirderSectionType.select.value
                return when(sectionType){
                    "6"->{
                        "钢桁梁"
                    }

                    else->{
                        "钢箱梁"
                    }
                }
            }
        }

        return "钢箱梁"
    }

    private fun getSpanValuesByBridgeLength(bridgeLength: String, size: Int): List<String> {
        val values = mutableListOf<String>()
        when (bridgeType) {
            "1" -> {
                //梁桥  均分
                val value = String.format("%.2f", bridgeLength.toDouble() / size)
                for (i in 0 until size) {
                    values.add(value)
                }
            }

            "3" -> {
                //斜拉桥  数量 =2的话0.5：1分，>2的话 头和尾 各0.4，中间均分
                if (size == 2) {
                    values.add(String.format("%.2f", bridgeLength.toDouble() * (0.5 / 1.5)))
                    values.add(String.format("%.2f", bridgeLength.toDouble() * (1 / 1.5)))
                } else {
                    val total = 0.4 * 2 + (size - 2) * 1
                    for (i in 0 until size) {
                        if (i == 0 || i == (size - 1)) {
                            values.add(
                                String.format(
                                    "%.2f",
                                    bridgeLength.toDouble() * (0.4 / total)
                                )
                            )
                        } else {
                            values.add(String.format("%.2f", bridgeLength.toDouble() * (1 / total)))
                        }
                    }
                }
            }
        }

        return values;
    }

    override fun onResume() {
        super.onResume()
        refreshBridgeType()

    }

    private fun initRefresh() {


    }


    override fun onDestroyView() {
        super.onDestroyView()
        bind = null
    }

    override fun refreshBridgeDetail(itemData: BridgeRecordItem) {
        this.itemData = itemData
        if (bind != null) {
            initView()
        }

    }

    override fun refreshBridgeType() {
        val bridgeType = (activity as? BridgeAddActivity)?.getBridgeType()
        if (bridgeType.isNullOrEmpty()) {
            return
        }
        if (!this.bridgeType.isNullOrEmpty() && this.bridgeType == bridgeType) {
            //不需要重复处理了
            return
        }
        this.bridgeType = bridgeType

        showView(mBind.icBoxColumnNumberContain, false)
        showView(mBind.icTfColumnHeight, false)
        showView(mBind.icCbMainMaterialType, false)
        showView(mBind.icCbMainMaterialType, false)
        showView(mBind.icCbSingleBeamInterfaceType, false)

        showView(mBind.icCbArchBridgeType, false)
        showView(mBind.icCbBasketHandleArch, false)
        showView(mBind.icTfArchRibNumber, false)
        showView(mBind.icTfArchRibHorizontalPalmNumber, false)
        showView(mBind.icTfArchRibHorizontalPalmSpace, false)
        showView(mBind.icCbArchSectionType, false)
        showView(mBind.icTfArchRiseSpanRatio, false)
        showView(mBind.icTfArchPillarSpace, false)
        showView(mBind.icTfSlingSpace, false)
        showView(mBind.icTfSlingNumber, false)

        showView(mBind.icTfStiffeningGirderSectionType, false)
        showView(mBind.icTfStiffeningGirderMaterialType, false)
        showView(mBind.icTfInclinedCableFaceNumber, false)
        showView(mBind.icTfSingleSideFaceIncliendCableNumber, false)
        showView(mBind.icCbMainTowerVerticalShape, false)
        showView(mBind.icCbMainTowerHorizontalShape, false)
        showView(mBind.icTfMainTowerFloorUpperLowerHeightRatio, false)
        showView(mBind.icTfMainTowerFloorUpperHeight, false)
        showView(mBind.icCbAuxiliaryPierNumber, false)

        showView(mBind.icTfMainCableRiseSpanRatio, false)
        showView(mBind.icTfAnchorDeckHeightDiffOne, false)
        showView(mBind.icTfAnchorDeckHeightDiffTwo, false)

        showView(mBind.icTfMainSpanLenght, false)
        showView(mBind.icTfMainSpanNumber, false)
        showView(mBind.icTfSideSpanLengthOne, false)
        showView(mBind.icTfAnchorSpanLengthOne, false)
        showView(mBind.icTfSideSpanLengthTwo, false)
        showView(mBind.icTfAnchorSpanLengthTwo, false)
        val selectItem=mBind.icCbBridgeSpanNumber.select
        //根据桥梁类型判断 展示的字段
        when (bridgeType) {
            "1" -> {
                showView(mBind.icBoxColumnNumberContain, true)
                showView(mBind.icTfColumnHeight, true)
                showView(mBind.icCbSingleBeamInterfaceType, true)
                showView(mBind.icCbMainMaterialType, true)
                Logger.i("初始化跨径布置，切换跨境数据源 1")
                mBind.icCbBridgeSpanNumber.setItems(BridgeDataHelper.getMainSpanNumberType1List())
                selectItem?.let {
                    mBind.icCbBridgeSpanNumber.setSelectValue(it.value)
                }

            }

            "3" -> {
                showView(mBind.icTfStiffeningGirderSectionType, true)
                showView(mBind.icTfStiffeningGirderMaterialType, true)
                showView(mBind.icTfInclinedCableFaceNumber, true)
                showView(mBind.icTfSingleSideFaceIncliendCableNumber, true)
                showView(mBind.icCbMainTowerVerticalShape, true)
                showView(mBind.icCbMainTowerHorizontalShape, true)
                showView(mBind.icTfMainTowerFloorUpperLowerHeightRatio, true)
                showView(mBind.icTfMainTowerFloorUpperHeight, true)
                showView(mBind.icCbAuxiliaryPierNumber, true)
                Logger.i("初始化跨径布置，切换跨境数据源 3")
                mBind.icCbBridgeSpanNumber.setItems(BridgeDataHelper.getMainSpanNumberType3List())
                selectItem?.let {
                    mBind.icCbBridgeSpanNumber.setSelectValue(it.value)
                }

            }

        }

        initDefaultValue()
    }

    private var defaultData: IdentifyCaeData? = null
    private fun initDefaultValue() {
        if (itemData != null) {
            return
        }
        val editable = true
        val data = getDefaultValue()
        defaultData = data
        dealData(data, editable)

    }

    private fun getDefaultValue(): IdentifyCaeData {
        val bean = IdentifyCaeData(
            spanArrangement = "[]",
            bridgeWidth = "10",
            bridgeLength = "1100",
            mainMaterialType = "混凝土",
            unilateralLane = "3",
            bicycleLane = "0",
            sideWalk = "0",
            dividedSection = "0",
            singleBeamInterfaceType = "1",
            constructionYear = "2000",
            archBridgeType = "下承式",
            basketHandleArch = "0",
            archRibNumber = "0",
            archRibHorizontalPalmNumber = "5",
            archRibHorizontalPalmSpace = "0.6",
            archSectionType = "钢筋混凝土",
            archRiseSpanRatio = "0.2",
            archPillarSpace = "0",
            slingNumber = "0",
            slingSpace = "12",
            stiffeningGirderMaterialType = "钢",
            stiffeningGirderSectionType = "整体箱式",
            inclinedCableFaceNumber = "2",
            singleSideFaceInclinedCableNumber = "25",
            mainTowerVerticalShape = "1字式",
            mainTowerHorizontalShape = "倒Y式",
            mainTowerFloorUpperLowerHeightRatio = "1.2",
            mainTowerFloorUpperHeight = "75.0",
            auxiliaryPier = "1",
            auxiliaryPierNumber = "1",
            mainCableRiseSpanRatio = "0.1",
            anchorDeckHeightDiffOne = "50",
            anchorDeckHeightDiffTwo = "50",
            mainCableSpanArrangement = "[]",
            mainSpanLength = "",
            mainSpanNumber = "",
            sideSpanLengthOne = "",
            sideSpanLengthTwo = "",
            anchorSpanLengthOne = "",
            anchorSpanLengthTwo = "",
            columnNumSpan = "[]",
            columnHeight = "0",
            resultJson = ""
        )
        return when (bridgeType) {
            "1" -> {
                bean.spanArrangement = "[45]"
                bean.columnNumSpan = "[1,2]"
                bean.columnHeight = "45"
                bean.bridgeWidth = "25.5"
                bean.bridgeLength = "45"
                bean.mainMaterialType = "1"
                bean.singleBeamInterfaceType = "2"
                bean
            }

            "3" -> {
                bean.spanArrangement = "[243,602,243]"
                bean.bridgeWidth = "25"
                bean.bridgeLength = "1100"
                bean.stiffeningGirderMaterialType = "3"
                bean.stiffeningGirderSectionType = "3"
                bean.inclinedCableFaceNumber = "2"
                bean.singleSideFaceInclinedCableNumber = "31"
                bean.mainTowerVerticalShape = "1"
                bean.mainTowerHorizontalShape = "2"
                bean.mainTowerFloorUpperLowerHeightRatio = "3"
                bean.mainTowerFloorUpperHeight = "170.0"
                bean.auxiliaryPierNumber = "1"
                bean
            }

            else -> {
                bean
            }

        }
    }

    private fun dealData(data: IdentifyCaeData, editable: Boolean) {

        dealTextField(mBind.icTfBridgeLength, data.bridgeLength, editable)
        Logger.i("初始化跨径布置，赋值，${data.spanArrangement}")
        dealSpan(mBind.icBoxSpanArrangementContain, data.spanArrangement, editable)
        dealSpan(mBind.icBoxColumnNumberContain, data.columnNumSpan, editable)
        dealTextField(mBind.icTfColumnHeight, data.columnHeight, editable)
        Logger.i("初始化跨径布置，跨径设置的数量，${mBind.icBoxSpanArrangementContain.spanData.size.toString()}")
        dealSpinner(
            mBind.icCbBridgeSpanNumber,
            mBind.icBoxSpanArrangementContain.spanData.size.toString(),
            editable
        )
        dealTextButtonField(mBind.icTfBridgeWidth, data.bridgeWidth, editable)
        dealSpinner(mBind.icCbMainMaterialType, data.mainMaterialType, editable)
        dealTextField(mBind.icTfConstructionYear, data.constructionYear, editable)

        dealSpinner(mBind.icCbSingleBeamInterfaceType, data.singleBeamInterfaceType, editable)
        dealSpinner(mBind.icCbArchBridgeType, data.archBridgeType, editable)
        dealCheckBox(mBind.icCbBasketHandleArch, data.basketHandleArch, editable)

        dealTextField(
            mBind.icTfArchRibHorizontalPalmNumber,
            data.archRibHorizontalPalmNumber,
            editable
        )
        dealTextField(
            mBind.icTfArchRibHorizontalPalmSpace,
            data.archRibHorizontalPalmSpace,
            editable
        )
        dealSpinner(mBind.icCbArchSectionType, data.archSectionType, editable)
        dealTextField(mBind.icTfArchRiseSpanRatio, data.archRiseSpanRatio, editable)
        dealTextField(mBind.icTfArchPillarSpace, data.archPillarSpace, editable)
        dealTextField(mBind.icTfSlingSpace, data.slingSpace, editable)
        dealTextField(mBind.icTfSlingNumber, data.slingNumber, editable)
        Logger.i("联动，初始化材料类型类型")
        dealSpinner(
            mBind.icTfStiffeningGirderMaterialType,
            data.stiffeningGirderMaterialType,
            editable
        )
//        Logger.i("联动，初始化截面类型")
        dealSpinner(
            mBind.icTfStiffeningGirderSectionType,
            data.stiffeningGirderSectionType,
            editable
        )

        dealTextField(mBind.icTfInclinedCableFaceNumber, data.inclinedCableFaceNumber, editable)
        dealTextField(
            mBind.icTfSingleSideFaceIncliendCableNumber,
            data.singleSideFaceInclinedCableNumber,
            editable
        )
        dealSpinner(mBind.icCbMainTowerVerticalShape, data.mainTowerVerticalShape, editable)
        dealSpinner(mBind.icCbMainTowerHorizontalShape, data.mainTowerHorizontalShape, editable)
        dealTextField(
            mBind.icTfMainTowerFloorUpperLowerHeightRatio,
            data.mainTowerFloorUpperLowerHeightRatio,
            editable
        )
        dealTextButtonField(
            mBind.icTfMainTowerFloorUpperHeight,
            data.mainTowerFloorUpperHeight,
            editable
        )
        dealSpinner(mBind.icCbAuxiliaryPierNumber, data.auxiliaryPierNumber, editable)
        dealTextField(mBind.icTfMainCableRiseSpanRatio, data.archRiseSpanRatio, editable)
        dealTextField(mBind.icTfAnchorDeckHeightDiffOne, data.anchorDeckHeightDiffOne, editable)
        dealTextField(mBind.icTfAnchorDeckHeightDiffTwo, data.anchorDeckHeightDiffTwo, editable)

        dealTextField(mBind.icTfMainSpanLenght, data.mainSpanLength, editable)
        dealTextField(mBind.icTfMainSpanNumber, data.mainSpanNumber, editable)
        dealTextField(mBind.icTfSideSpanLengthOne, data.sideSpanLengthOne, editable)
        dealTextField(mBind.icTfAnchorSpanLengthOne, data.anchorSpanLengthOne, editable)
        dealTextField(mBind.icTfSideSpanLengthTwo, data.sideSpanLengthTwo, editable)
        dealTextField(mBind.icTfAnchorSpanLengthTwo, data.anchorSpanLengthTwo, editable)
    }

    override fun dealRequestParam(mapParent: MutableMap<String, Any>) {
        val map = mutableMapOf<String, Any>()
        mapParent.put("identifyCae", map)

        addTextFieldParam(map, mBind.icTfBridgeLength, "bridgeLength", "桥梁总长度")
        addTextButtonFieldParam(map, mBind.icTfBridgeWidth, "bridgeWidth", "桥梁宽度")
        addTextFieldParam(
            map,
            mBind.icTfConstructionYear,
            "constructionYear",
            "桥梁建设年代",
            necessary = false
        )
        addSpanParam(map, mBind.icBoxSpanArrangementContain, "spanArrangement", "桥梁跨径布置")

        //根据桥梁类型判断 展示的字段
        when (bridgeType) {
            "1" -> {

                addSpanParam(map, mBind.icBoxColumnNumberContain, "columnNumSpan", "立柱数量")
                addTextFieldParam(
                    map,
                    mBind.icTfColumnHeight,
                    "columnHeight",
                    "立柱高度",
                    necessary = false
                )
                addSpinnerParam(map, mBind.icCbMainMaterialType, "mainMaterialType", "主梁材料类型")
                addSpinnerParam(map, mBind.icCbMainMaterialType, "mainMaterialType", "主梁材料类型")
                addSpinnerParam(
                    map,
                    mBind.icCbSingleBeamInterfaceType,
                    "singleBeamInterfaceType",
                    "主梁截面类型",
                    necessary = false
                )
            }

            "3" -> {
                addSpinnerParam(
                    map,
                    mBind.icTfStiffeningGirderMaterialType,
                    "stiffeningGirderMaterialType",
                    ""
                )
                addSpinnerParam(
                    map,
                    mBind.icTfStiffeningGirderSectionType,
                    "stiffeningGirderSectionType",
                    ""
                )
                addTextFieldParam(
                    map,
                    mBind.icTfInclinedCableFaceNumber,
                    "inclinedCableFaceNumber",
                    "斜拉索面数"
                )
                addTextFieldParam(
                    map,
                    mBind.icTfSingleSideFaceIncliendCableNumber,
                    "singleSideFaceInclinedCableNumber",
                    "每面斜拉索数量"
                )
                addSpinnerParam(
                    map,
                    mBind.icCbMainTowerVerticalShape,
                    "mainTowerVerticalShape",
                    "主塔纵向形状"
                )
                addSpinnerParam(
                    map,
                    mBind.icCbMainTowerHorizontalShape,
                    "mainTowerHorizontalShape",
                    "主塔横向形状"
                )
                addTextFieldParam(
                    map,
                    mBind.icTfMainTowerFloorUpperLowerHeightRatio,
                    "mainTowerFloorUpperLowerHeightRatio",
                    "主塔桥面上下部高度比"
                )
                addTextButtonFieldParam(
                    map,
                    mBind.icTfMainTowerFloorUpperHeight,
                    "mainTowerFloorUpperHeight",
                    "主塔桥面上部高度"
                )
                addSpinnerParam(
                    map,
                    mBind.icCbAuxiliaryPierNumber,
                    "auxiliaryPierNumber",
                    "辅助墩数量"
                )
            }
        }
    }

    override fun check() {


        checkTextButton(mBind.icTfBridgeWidth, itemData?.identifyCae?.bridgeWidth)
        checkText(mBind.icTfConstructionYear, itemData?.identifyCae?.constructionYear)
        checkSpan(mBind.icBoxSpanArrangementContain, itemData?.identifyCae?.spanArrangement)

        //根据桥梁类型判断 展示的字段
        when (bridgeType) {
            "1" -> {
                checkSpan(mBind.icBoxColumnNumberContain, itemData?.identifyCae?.columnNumSpan)
                checkText(mBind.icTfColumnHeight, itemData?.identifyCae?.columnHeight)
                checkSpinner(mBind.icCbMainMaterialType, itemData?.identifyCae?.mainMaterialType)
                checkSpinner(
                    mBind.icCbSingleBeamInterfaceType,
                    itemData?.identifyCae?.singleBeamInterfaceType
                )
            }

            "3" -> {


                checkSpinner(
                    mBind.icTfStiffeningGirderMaterialType,
                    itemData?.identifyCae?.stiffeningGirderMaterialType
                )
                checkSpinner(
                    mBind.icTfStiffeningGirderSectionType,
                    itemData?.identifyCae?.stiffeningGirderSectionType
                )
                checkText(
                    mBind.icTfInclinedCableFaceNumber,
                    itemData?.identifyCae?.inclinedCableFaceNumber
                )
                checkText(
                    mBind.icTfSingleSideFaceIncliendCableNumber,
                    itemData?.identifyCae?.singleSideFaceInclinedCableNumber
                )
                checkSpinner(
                    mBind.icCbMainTowerVerticalShape,
                    itemData?.identifyCae?.mainTowerVerticalShape
                )
                checkSpinner(
                    mBind.icCbMainTowerHorizontalShape,
                    itemData?.identifyCae?.mainTowerHorizontalShape
                )
                checkText(
                    mBind.icTfMainTowerFloorUpperLowerHeightRatio,
                    itemData?.identifyCae?.mainTowerFloorUpperLowerHeightRatio
                )
                checkTextButton(
                    mBind.icTfMainTowerFloorUpperHeight,
                    itemData?.identifyCae?.mainTowerFloorUpperHeight
                )
                checkSpinner(
                    mBind.icCbAuxiliaryPierNumber,
                    itemData?.identifyCae?.mainTowerFloorUpperHeight
                )
            }
        }
    }

}